package com.hdoit.ares.logical.insu.dao.impl;

import java.util.List;

import org.springframework.stereotype.Component;

import com.hdoit.ares.logical.insu.dao.IZhonganCarDao;
import com.hdoit.ares.logical.insu.model.ZhonganCar;
import com.tennetcn.common.dao.base.IFinderExpression;
import com.tennetcn.common.dao.base.impl.SuperDao;
import com.tennetcn.common.enums.OrderEnum;
import com.tennetcn.common.utils.FinderExpressionFactory;
/**
 * @author      caochengmeng
 * @email       
 * @createtime  2018年01月16日 11:54:54
 * @comment
 */
@Component
public class ZhonganCarDaoImpl extends SuperDao<ZhonganCar> implements IZhonganCarDao{

	@Override
	public List<ZhonganCar> queryAllCarInsu(String customerId) {
		IFinderExpression finderExpression=FinderExpressionFactory.createExpression();
		finderExpression.select("*")
						.from(ZhonganCar.class)
						.andEq("customerId",customerId)
						.addOrder("requestDate", OrderEnum.desc);
	    return queryList(finderExpression);
	}

	@Override
	public ZhonganCar queryModelByVehiclePolicyOrderNoAndVehicleType(String vehiclePolicyOrderNo,String vehicleType) {
		IFinderExpression finderExpression=FinderExpressionFactory.createExpression();
		finderExpression.select("*")
						.from(ZhonganCar.class)
						.andEq("vehiclePolicyOrderNo",vehiclePolicyOrderNo)
						.andEq("vehicleType",vehicleType);
	    return queryModel(finderExpression);
	}

	@Override
	public ZhonganCar queryModelByPolicyNo(String policyNo) {
		IFinderExpression finderExpression=FinderExpressionFactory.createExpression();
		finderExpression.select("*")
						.from(ZhonganCar.class)
						.andEq("policyNo",policyNo);
	    return queryModel(finderExpression);
	}

}